package com.justgame.project.service.just.service.basic;

import com.justgame.project.service.just.entity.JustGameCloud;
import com.justgame.project.service.just.query.JustGameCloudQuery;
import com.justgame.project.service.just.wrapper.JustGameCloudWrapper;
import com.justgame.project.base.servcice.IBasicService;
import java.lang.Long;
import org.springframework.util.Assert;
import org.springframework.lang.NonNull;
import java.lang.String;

/**
 *
 * 游戏资源网盘映射表服务自定义查询类
 *
 * @@tableName just_game_cloud
 * @author Zwb
 */
@SuppressWarnings("all")
public interface BasicJustGameCloudService extends IBasicService<JustGameCloudQuery,JustGameCloud,JustGameCloudWrapper> {

   /**
    * 新增创建
    * @param title 标题
    * @param path 云盘链接
    * @param secretKey 云盘密钥
    * @param gameInfoId 游戏信息
    */
   default JustGameCloud baseAdd(String title, String path, String secretKey, Long gameInfoId){
      JustGameCloud justGameCloud = new JustGameCloud();
      justGameCloud.setTitle(safeValue(title, null));
      justGameCloud.setPath(safeValue(path, null));
      justGameCloud.setSecretKey(safeValue(secretKey, null));
      justGameCloud.setGameInfoId(safeValue(gameInfoId, null));
      save(justGameCloud);
      return justGameCloud;
   }

   /**
    * 更新
    * @param title 标题
    * @param path 云盘链接
    * @param secretKey 云盘密钥
    * @param gameInfoId 游戏信息
    */
   default boolean baseUpdate(@NonNull JustGameCloud justGameCloud,String title, String path, String secretKey, Long gameInfoId){
      Assert.notNull(title,"必须提供标题");
      Assert.notNull(path,"必须提供云盘链接");
      Assert.notNull(secretKey,"必须提供云盘密钥");
      Assert.notNull(gameInfoId,"必须提供游戏信息");
      Assert.notNull(justGameCloud.getId(),"必须提供主键ID");
      justGameCloud.setTitle(safeValue(title, null));
      justGameCloud.setPath(safeValue(path, null));
      justGameCloud.setSecretKey(safeValue(secretKey, null));
      justGameCloud.setGameInfoId(safeValue(gameInfoId, null));
      return updateById(justGameCloud);
   }

}